<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition >
            <p:panel >
                <h:panelGrid columns="2" >
                    <p:commandButton value="Novo Insert" 
                                     icon="iconNovo"
                                     id="btnNovo2"
                                     action="#{albumBean.novoDisco()}"
                                     update=":geral:pnlProcesso"/>
                    <p:commandButton value="Voltar Esc"
                                     id="btnVoltar4"
                                     action="#{albumBean.voltar()}"
                                     icon="iconFechar"
                                     update=":geral:pnlProcesso, :geral:mensagem"/>


                </h:panelGrid>
            </p:panel>

            <br/>
            <p:panel header="Listar Discos">
            <p:dataTable id="dtDisco" var="disco" value="#{albumBean.discos}"
                         paginator="true" rows="15"
                         style="width: auto; height: auto"
                         emptyMessage="Sem Registros">
                <p:column headerText="Nome ">
                    <h:outputText value="#{disco.nomeDisco}"/>
                </p:column>
                <p:column headerText="Disco Número ">
                    <h:outputText value="#{disco.num}"/>
                </p:column>
                <p:column width="60">
                    <f:facet name="header">  
                        <h:outputText value="Opções"/>  
                    </f:facet> 
                    <p:commandButton update=":geral:pnlProcesso"
                                     value="Abrir Disco" 
                                     action="#{albumBean.irMusicas}">

                        <f:setPropertyActionListener 
                            target="#{albumBean.disco}" 
                            value="#{disco}"/>
                    </p:commandButton>
                    <p:commandButton  
                        value="Excluir Disco" 
                        action="#{albumBean.irExcluirDisco}"
                                     update=":geral:pnlProcesso, :geral:mensagem">
                        <f:setPropertyActionListener 
                            target="#{albumBean.disco}" 
                            value="#{disco}"/>
                    </p:commandButton>
                </p:column>
            </p:dataTable>
            </p:panel>
        </ui:composition>

    </body>
</html>